﻿<navigation:Page
  x:Class="WebRSSBuilder.Home" 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:m="clr-namespace:WebRSSBuilder.Models"
  xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
  mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"  
  Style="{StaticResource PageStyle}" xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices" xmlns:my="clr-namespace:WebRSSBuilder.Web" xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk">
    <UserControl.Resources>
        <m:HomePageViewModel x:Key="MyViewModel" />
    </UserControl.Resources>
        <Grid x:Name="LayoutRoot">
    <ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}" >

      <StackPanel x:Name="ContentStackPanel" Style="{StaticResource ContentStackPanelStyle}">

        <TextBlock x:Name="HeaderText" Style="{StaticResource HeaderTextStyle}" 
                           Text="{Binding Path=ApplicationStrings.HomePageTitle, Source={StaticResource ResourceWrapper}}"/>
        <TextBlock x:Name="ContentText" Style="{StaticResource ContentTextStyle}" 
                           Text="{Binding  Source={StaticResource MyViewModel}, Path=WelcomeText}"/>
                <riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my:File, CreateList=true}" Height="0" LoadedData="fileDomainDataSource_LoadedData" Name="fileDomainDataSource" QueryName="GetFilesInRole" Width="0">
                    <riaControls:DomainDataSource.DomainContext>
                        <my:DomainServiceDB />
                    </riaControls:DomainDataSource.DomainContext>
                </riaControls:DomainDataSource>
                <sdk:DataGrid AutoGenerateColumns="False" Visibility="{Binding Source={StaticResource MyViewModel}, Path=IsAuth}" Height="200" ItemsSource="{Binding ElementName=fileDomainDataSource, Path=Data}" Name="fileDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected" Width="400">
                    <sdk:DataGrid.Columns>
                        <sdk:DataGridTextColumn x:Name="fileNameColumn" Binding="{Binding Path=FileName}" Width="200" IsReadOnly="True" Header="File Name" />
                        <sdk:DataGridTextColumn x:Name="fileURLColumn" Binding="{Binding Path=FileURL}" Width="198" IsReadOnly="True" Header="File URL"  />
                    </sdk:DataGrid.Columns>
                </sdk:DataGrid>
                <Button Content="Go" Height="23" Name="buttonGo" Visibility="{Binding Source={StaticResource MyViewModel}, Path=IsAuth}" Width="75" Command="{Binding Source={StaticResource MyViewModel}, Path=Navigate}" CommandParameter="{Binding ElementName=fileDataGrid, Path=SelectedItem}" />
            </StackPanel>

    </ScrollViewer>
  </Grid>

</navigation:Page>